package com.baichen.spring.web;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

public interface HandlerInterceptor {
    // 在Controller方法调用前执行，返回false则中断后续流程
    boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception;

    // 在Controller方法调用后执行
    void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, Object result) throws Exception;

    // 请求完成后（包括异常）执行
    void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception;
}

